4D Chart v13

CT INSERT FIELD

Home

 
4D Chart v13
CT INSERT FIELD

CT INSERT FIELD 


 

CT INSERT FIELD ( area ; scope ; first ; last ; numTable ; numField ; format ) 
Parameter Type   Description
area  Longint in 4D Chart area
scope  Longint in -1 = First object in document 0 = First object in selection >0 = Object ID
first  Integer in Position of first character minus 1
last  Integer in Position of last character
numTable  Integer in Table number of reference
numField  Integer in Field number of reference
format  String in Format of reference

The CT INSERT FIELD command inserts a field reference into the text object in area described by scope.

  • If scope equals -1, CT INSERT FIELD inserts the reference into the first object of the document.
  • If scope equals 0, CT INSERT FIELD inserts the reference into the first selected object.
  • If scope is greater than 0, it must be equal to a specific text object’s ID and the reference is inserted within that text object. If the object does not exist, CT INSERT FIELD does nothing.

If the object described by scope is not a text object, CT INSERT FIELD does nothing.

first and last determine where the reference is inserted. first is one less than the first character position to be replaced and last is the last character position to be replaced. If first equals last, no characters are replaced and the reference is inserted between first and first +1. If last is greater than the number of characters in the text object, CT INSERT FIELD replaces characters from first to the last character in the text object.

table and field determine which field is referenced. table is the number of the table and field is the number of the field. Tables and fields are numbered in the order in which they were created.

The optional format parameter is the display format for the reference. This option is equivalent to choosing a format from the Format dialog box. Formats are referred to by either their number or their name. Formats are numbered in the order in which they appear in the list of the Format dialog box.

If format is a one- or two-digit string, then the format applied to field is from the list. If format is not a one- or two-digit string, then it is compared to the text values of each format in the list. If it matches one of the values in the list, that format is applied. This means that you can refer to the first date format as either “19” or “Short”.

If format is not in the list of formats, it is interpreted as a custom numeric format. If format is inappropriate for the resulting value of the reference, it is ignored. For instance, if you use a date format on a number, the number appears unformatted.

This example inserts a reference to the first field of the first table into the text object that has an ID of 1, replacing any text in the object, and then formats it according to the eleventh format in the list.

 CT INSERT FIELD(Area;1;0;32000;1;1;"11")

You can use 4D’s Field and Table functions to determine a field or table’s number. This can make your code easier to read. For example, if the field used in the previous example is [Customers]Name, the code would look like this:

 CT INSERT FIELD(Area;1;0;32000;Table(->[Customers]);Field(->Name);"11")

 
PROPERTIES 

Product: 4D Chart
Theme: CT Objects
Number: 14601

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D Chart 1

 
SEE ALSO 

CT INSERT EXPRESSION